package cn.jellybmedia.basic.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* @Title:
* @Description: 返回Ajax数据
* @Author: Mr.Zhang
* @Version: 1.0
* @Date:  2022/6/27 8:36
* @Parameters:
* @Return
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AjaxResult {
    public Boolean success =true;
    public String message = "操作成功!";

    // 上传图片的接收
    private Object resultObj;


    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }



    public AjaxResult setMessage(String message) {
        this.message = message;
        return this;
    }

    public static AjaxResult getAjaxResult(){
        return new AjaxResult();
    }

    public static AjaxResult error(){
        return new AjaxResult().setSuccess(false).setMessage("系统繁忙,请稍后重试");
    }


    // 方便用于链式编程
    public AjaxResult setResultObj(Object resultObj) {
        this.resultObj = resultObj;
        return this;
    }
}
